//
//  NSString+TextHeight.m
//  StoneMason
//
//  Created by iOS1 on 16/12/17.
//  Copyright © 2016年 iOS1. All rights reserved.
//

#import "NSString+TextHeight.h"

@implementation NSString (TextHeight)

-(CGFloat)widthInSize:(CGSize)size font:(NSInteger)font{
    CGRect rect = [self boundingRectWithSize:size options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:FONT(font)} context:nil];
    return rect.size.width;
}

-(CGFloat)heightInSize:(CGSize)size font:(NSInteger)font{
    CGRect rect = [self boundingRectWithSize:size options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:FONT(font)} context:nil];
    return rect.size.height;
}
- (CGSize)getSize:(NSString *)text font:(NSInteger)font{
    return [text sizeWithAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:font]}];
}
@end
